import pypinyin


class province:
    name = ""
    id = ""
    first_letter = ""

    def __init__(self, province_name, province_id, province_first_letter="", high_school=None):
        if high_school is None:
            high_school = []
        self.name = province_name
        self.id = province_id
        self.first_letter = province_first_letter
        if self.first_letter is None or self.first_letter == "":
            self.first_letter = pypinyin.pinyin(self.name, style=pypinyin.FIRST_LETTER)[0][0].upper()
        self.high_school = high_school

    def to_dict(self):
        return {"name": self.name, "id": self.id, "first_letter": self.first_letter, "high_school": self.high_school}


class school:
    def __init__(self, name, id, type="", province=""):
        self.name = name
        self.id = id
        self.type = type
        self.province = province

    def to_dict(self):
        return {"name": self.name, "id": self.id, "type": self.type, "proid": self.province}
